home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_400 / 424_02 / ED-157 / ref_window.c < prev    next >
C/C++ Source or Header  |  1993-09-10  |  3KB  |  106 lines

  1. /*
  2.  * Copyright (C) 1992 by Rush Record (rhr@clio.rice.edu)
  3.  * 
  4.  * This file is part of ED.
  5.  * 
  6.  * ED is free software; you can redistribute it and/or modify it under the terms
  7.  * of the GNU General Public License as published by the Free Software Foundation.
  8.  * 
  9.  * ED is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
  10.  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
  11.  * PARTICULAR PURPOSE.  See the GNU General Public License for more details.
  12.  * 
  13.  * You should have received a copy of the GNU General Public License along with ED
  14.  * (see the file COPYING).  If not, write to the Free Software Foundation, 675
  15.  * Mass Ave, Cambridge, MA 02139, USA.
  16.  */
  17. #include "opsys.h"
  18.  
  19. #include <string.h>
  20.  
  21. #include "rec.h"
  22. #include "window.h"
  23. #include "ed_dec.h"
  24.  
  25. /******************************************************************************\
  26. |Routine: window_title
  27. |Callby: define_key ref_window
  28. |Purpose: Returns the window title string.
  29. |Arguments:
  30. |    w is the window number.
  31. \******************************************************************************/
  32.  
  33. Char *window_title(w)
  34. Int w;
  35. {
  36.     static Char buf[512];
  37.     
  38.     if(definition_inprog() == w)
  39.         strcpy(buf,"Defining key...");
  40.     else
  41.     {
  42.         if(host_in_name(WINDOW[w].filename))
  43.             switch(ftp_system(WINDOW[w].filename))
  44.             {
  45.                 case 'U':
  46.                     strcpy(buf,"(Unix)");
  47.                     break;
  48.                 case 'M':
  49.                     strcpy(buf,"(MS-DOS)");
  50.                     break;
  51.                 case 'W':
  52.                     strcpy(buf,"(WNT)");
  53.                     break;
  54.                 case 'O':
  55.                     strcpy(buf,"(OS/2)");
  56.                     break;
  57.                 case 'V':
  58.                     strcpy(buf,"(VMS)");
  59.                     break;
  60.                 case 'I':
  61.                     strcpy(buf,"(VM)");
  62.                     break;
  63.                 default:
  64.                     strcpy(buf,"(unknown system)");
  65.             }
  66.         else
  67.             buf[0] = '\0';
  68.         strcat(buf,WINDOW[w].filename);
  69.     }
  70.     return(buf);
  71. }
  72.  
  73. /******************************************************************************\
  74. |Routine: ref_window
  75. |Callby: bigger_win edit insert_win ref_display scroll_down scroll_up slip_message smaller_win sort_recs
  76. |Purpose: Refreshes a particular window.
  77. |Arguments:
  78. |    w is the window to refresh.
  79. \******************************************************************************/
  80. void ref_window(w)
  81. Int w;
  82. {
  83.     Char *p;    /* to hold, possibly, system type, and, definitely, either "Defining key..." or filename */
  84.     
  85.     p = window_title(w);
  86.     if(w == CURWINDOW)
  87.     {
  88.         move(TOPROW - 1,1);
  89.         ers_end();
  90.         reverse();
  91.         putz(p);
  92.         normal();
  93.         paint(TOPROW,BOTROW,FIRSTCOL);
  94.     }
  95.     else
  96.     {
  97.         move(WINDOW[w].toprow - 1,1);
  98.         ers_end();
  99.         reverse();
  100.         putz(p);
  101.         normal();
  102.         paint_window(w,WINDOW[w].toprow,WINDOW[w].botrow,WINDOW[w].firstcol);
  103.     }
  104. }
  105.  
  106.